# 暴力破解
n,m,k = map(int,input().split())
a = [[0] for _ in range(n)]
a.insert(0,[0]*m)
print(a)
for i in range(1,n+1):
  a[i].extend(map(int,input().split()))
ans = 0
for i1 in range(1,n+1):
    for i2 in range(i1,n+1):
        for j1 in range(1,m+1):
            for j2 in range(j1,m+1):
                sum = 0
                for i in range(i1,i2+1):
                    for j in range(j1,j2+1):
                        sum += a[i][j]
                if sum <= k: ans += 1
print(ans)